/*package com.nuanshui.heatedloan.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import javax.persistence.EntityManagerFactory;

import org.springframework.aop.support.JdkRegexpMethodPointcut;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import com.alibaba.druid.support.spring.stat.DruidStatInterceptor;

@Configuration
@ComponentScan(basePackages= {"com.nuanshui", "com.nuanshui"},
	excludeFilters = {
		@Filter(type=FilterType.ANNOTATION, value=EnableWebMvc.class),@Filter(type=FilterType.ANNOTATION, value=Configuration.class)
})
@ImportResource({"classpath:applicationContext.xml", "classpath:applicationContext-dubbo.xml"})
public class RootConfig {
	
	*//**
	 * Jpa Entity Manager 配置 
	 * @author Gonzo
	 * @date 2016年12月30日上午10:32:38
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public LocalContainerEntityManagerFactoryBean entityManagerFactory(JpaVendorAdapter jpaVendorAdapter){
		LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
		
		entityManagerFactory.setJpaVendorAdapter(jpaVendorAdapter);
		entityManagerFactory.setPackagesToScan("com.nuanshui.heatedloan");
		InputStream is = null;
		
		try{
			is = new ClassPathResource("jpaProperties.properties").getInputStream();
			Properties properties = new Properties();
			properties.load(is);
			entityManagerFactory.setJpaProperties(properties);
			
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if(is != null){
				try {
					is.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		
		return entityManagerFactory;
	}
	
	*//**
	 *  指明哪一个厂商JPA的实现 
	 * @author Gonzo
	 * @date 2016年12月30日上午10:12:31
	 * @param database
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public JpaVendorAdapter jpaVendorAdapter(){
		HibernateJpaVendorAdapter HibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
		HibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
		HibernateJpaVendorAdapter.setShowSql(true);
		HibernateJpaVendorAdapter.setGenerateDdl(false);
		HibernateJpaVendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQLDialect");
		return HibernateJpaVendorAdapter;
	}
	
	
	
	*//**
	 * JSR303 Validator定义
	 * @author Gonzo
	 * @date 2016年12月30日上午10:12:49
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public LocalValidatorFactoryBean localValidatorFactoryBean(){
		LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
		return localValidatorFactoryBean;
	}
	
	
	*//**
	 * Jpa 事务配置 
	 * @author Gonzo
	 * @date 2016年12月30日上午10:15:34
	 * @param entityManagerFactory
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public JpaTransactionManager jpaTransactionManager(EntityManagerFactory entityManagerFactory){
		JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
		jpaTransactionManager.setEntityManagerFactory(entityManagerFactory);
		return jpaTransactionManager;
	}
	
	
	*//**
	 * 创建spring线程池 
	 * @author Gonzo
	 * @date 2016年12月30日上午10:20:03
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public ThreadPoolTaskExecutor threadPoolTaskExecutor(){
		ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
		threadPoolTaskExecutor.setCorePoolSize(30);
		threadPoolTaskExecutor.setMaxPoolSize(80);
		threadPoolTaskExecutor.setQueueCapacity(300);
		
		return threadPoolTaskExecutor;
	}
	
	@Bean
	public DruidStatInterceptor druidStatInterceptor(){
		DruidStatInterceptor druidStatInterceptor = new DruidStatInterceptor();
		return druidStatInterceptor;
	}
	
	@Bean
	public JdkRegexpMethodPointcut jdkRegexpMethodPointcut(){
		JdkRegexpMethodPointcut jdkRegexpMethodPointcut = new JdkRegexpMethodPointcut();
		return jdkRegexpMethodPointcut;
	}
	
}
*/